package server.model.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import javax.validation.constraints.Min;

/**
 * 创建人:    xvzhe
 * 创建时间:
 * 修改时间:
 * 版本:      v1.0
 */
@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
@DynamicInsert
@DynamicUpdate
@ApiModel("菜单表")
public class MenuEntity {
    @Id
    @GeneratedValue(generator = "NumberIdProduce")
    @GenericGenerator(name = "NumberIdProduce", strategy = "server.tool.idProduce.NumberIdProduce")
    private String id;

    @ApiModelProperty("菜单名称")
    @Column(unique = true)
    private String name;

    @Column
    @ApiModelProperty("页面URL")
    private String uri;

    @Column
    @ApiModelProperty("图标")
    private String icon;

    @ApiModelProperty("菜单级数")
    @Column(columnDefinition = "int default 1")
    @Min(0)
    private Integer series;

    @Column
    @ApiModelProperty("父导航id")
    private String parentId;

    @ApiModelProperty("导航状态")
    @Column
    private Boolean status;

    @ApiModelProperty("排序")
    @Column(columnDefinition = "int default 1")
    Integer orders;
}
